<template>
  <div class="search-bar">
    <div class="search-bar-input">
      <input class="search-bar-input-dom" v-model="condition" @input="handleInput" type="text"  />
    </div>
    <div class="search-bar-btn">
      <span class="search-bar-btn-text">检索资源</span>
    </div>
  </div>
</template>

<script setup name="SearchBar">

const condition = ref('');

const emit = defineEmits(["update:modelValue"]);

const handleInput = () => {
  emit("update:modelValue", condition.value);
}

</script>

<style lang="scss" scoped>
.search-bar {
  display: flex;
  align-items: center;

  &-input {
    height: 44px;
    flex: 1;

    &-dom {
      outline: none;
      box-shadow: none;
      border: 2px solid var(--tc-input-border);
      height: 44px;
      font-size: 18px;
      border-radius: 10px 0 0 10px;
      border-right: none;
      width: 100%;
      padding: 0 10px;
    }

    &-dom:focus {
      outline: none;
      box-shadow: none;
      border: 2px solid var(--tc-input-active);
      border-right: none;
      width: 100%;
    }
  }

  &-btn {
    padding: 0 20px;
    height: 44px;
    background-color: var(--tc-input-active);
    display: flex;
    align-items: center;
    border-radius: 0 10px 10px 0;
    color: var(--tc-input-btn-text);
    user-select: none;
    cursor: pointer;

    &-text {
      font-size: 16px;
    }
  }
}
</style>

